package com.dkm.rocketmq;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 消息消费者
 * @author 狄凯明
 *
 */
@Component
@RocketMQMessageListener(
		topic = "topic1",
		consumerGroup = "my-group",
		selectorExpression = "*",
		consumeMode = ConsumeMode.CONCURRENTLY
)
public class Consumer implements RocketMQListener<String> {

	/**
	 * 接收消息时回调
	 */
	@Override
	public void onMessage(String message) {
		System.out.println("收到消息："+message);
		
	}

}
